/* @INLINE FILE facebook.bloc.js =============================================================
	* The Facebook Connect API
	* 
	* VAR
	* fb_src - url of facebook connect
    * fb_child
    * fb_receive_on
	* 
	* FUNC
	* this.fb_loaded
	* fb_post
	* this.init_fb_login
	* fb_login
	*/
	
    var fb_src = config.fb_connection_url+'/proxies/facebook/facebook_login.php?url=' + encodeURIComponent(document.location.href.split('#')[0]) + "&btn=" + encodeURIComponent(__(352,'Connect with Facebook'));
    var fb_child;
    var fb_receive_on=false;
    this.fb_loaded=function(){
    	var fb_iframe = jQ('#fc_fb_frame').css("visibility","visible")[0];
    	jQ('#fc_fb_load').css("visibility","hidden");
    	fb_child = fb_iframe.contentWindow;
    	//make sure this isnt used more than once
    	if(!fb_receive_on){
	    	jGo.postMessage.receive(
	    			  function(e){
	    			    if(e.data.indexOf('<fcchatresponse>')!=-1){
	    			    	fc_chat.init_fb_login(e.data)
	    			    }else if(e.data == 'lockauth'){
	    			    	$('fc_logintxt')[_i] = "<b>"+__(354,'Authorizing')+"...</b><br>";
	    			        lock_login(true);
	    			        l=true;
	    			    }else if(e.data == 'unlockauth'){
	    			    	$('fc_logintxt')[_i] = "";
	    			    	lock_login(false);
	    			    	l=false;
	    			    }
	    			  },
	    			  config.fb_connection_url
	    			);
	    	fb_receive_on=false;
    	}
    };
    
    var fb_post = function(msg){
    	jGo.postMessage.post(
    	  		msg,
    	  		fb_src,
    	  		fb_child
    		);
    };
    this.init_fb_login = function(data){
		auth_login(data,1);
    };
    var fb_login = function(){
    	new_screen_name=screen_name;
    	new_auth_token=auth_token;
    	request_alt_login=true;
    	fc_chat.login2(1);
    	request_alt_login=false;
    };
    
	//facebook.bloc.js =============================================================@END FILE*/